<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
    String context = jt.classic.system.ISystem.getContextPath();
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>报文注册页面</title>
<link rel="stylesheet" type="text/css" href="<%=context%>/app/mb/css/message.css" />
</head>
<jsp:include page="head.jsp"></jsp:include>

<body>
<script>
	Ext.onReady(function() {
		var csgridStore = new Ext.data.Store({
				reader : new Ext.data.ArrayReader({}, [ // 如何解析
						{
									name : 'c1'
								}, {
									name : 'c2'
								}, {
									name : 'c3'
								}]),
				data : [['控制器1','控制器1','控制器1'],
				['控制器2','控制器2','控制器2'],
				['控制器3','控制器3','控制器3']]

			});	

	var sm = new Ext.grid.CheckboxSelectionModel({
				handleMouseDown : Ext.emptyFn,
				singleSelect: false
			});	
	var cscols = [sm,{
				header : '控制器参数1',
				sortable : true,
				dataIndex : 'c1'
			}, {
				header : '控制器参数2',
				sortable : true,
				dataIndex : 'c2'
			}, {
				header : "控制器参数3",
				sortable : true,
				dataIndex : 'c3'
			}];
		
	var csgrid = new Ext.grid.GridPanel({
				id : 'csgrid',
				ddGroup : 'gridDDGroup',
				store : csgridStore,
				border : false,
				sm : sm,
				columns : cscols,
				region : 'center',
				enableDragDrop : false,
				stripeRows : true,
				autoExpandColumn : 'id',
				width : 525,
				height :450,
				viewConfig : {
					forceFit : true
				}
		
		});
		var cswin = new Ext.Window({
						renderTo : Ext.getBody(),
						layout : 'form',
						closable : true,
						width : 550,
						height :550,
						title : '选择控制器',
						plain : true,
						modal : true,
						items : [csgrid],
						buttons : [{
									text : '保存',
									handler : function() {
										selNodes = csgrid.getSelectionModel().getSelections();
									alert(selNodes);
										var Plant = csgrid.getStore().recordType;
										for(var i = 0 ; i < selNodes.length; i++){
											alert(selNodes[i].get('c1'))
//										var p = new Plant({
//										c1 : selectedNodes[i].get('c1'),
//										c2 : selectedNodes[i].get('c2'),
//										c3 : selectedNodes[i].get('c3')
//										});
//										rqgrid.stopEditing();
//										rqgridStore.insert(i, p);
//										rqgrid.startEditing(0, 0);
										}
										cswin.close();
										cswin = null;
									}
								}, {
									text : '取消',
									handler : function() {
										cswin.close();
										cswin = null;
									}
								}]
					}).show()
	
	
	})
</script>
<form id="form1" name="form1" method="post">
<div id="divstr" style="width:800px;600px;"></div>
</form>
</body>
</html>